<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:p="http://primefaces.prime.com.tr/ui"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                template="./../templates/TCubeStaffTemplate.xhtml">

    <ui:define name="content">
        <f:view beforePhase="#{staffUnlockAccountManagedBean.initView}">
            <h:form>
                <h:selectOneMenu id="searchBy" required="true" value="#{staffUnlockAccountManagedBean.accountSelected}" >
                    <f:selectItems value="#{staffUnlockAccountManagedBean.accountSelectedItems}" />
                </h:selectOneMenu>
                <p:commandButton id="btnSelectAccount" actionListener="#{staffUnlockAccountManagedBean.selectAccount}" value="Submit" update="accountPanel" ajax="true"/>
                <p:panel id="accountPanel">
                    <p:dataTable var="StaffAccountEntity" value="#{staffUnlockAccountManagedBean.accountList}" paginator="true" rows="10" selectionMode="single">  
                        <f:facet name="header">  
                            List of Accounts 
                        </f:facet>  
                        <p:column sortBy="#{StaffAccountEntity.username}" filterBy="#{StaffAccountEntity.username}">  
                            <f:facet name="header">  
                                <h:outputText value="Username" />  
                            </f:facet>  
                            <h:outputText value="#{StaffAccountEntity.username}" />  
                        </p:column>  
                        <p:column> 
                            <p:cellEditor>
                                <f:facet name="header">  
                                    <h:outputText value="Account Status" />  
                                </f:facet>  
                                <f:facet name="input">  
                                    <h:selectBooleanCheckbox value="#{StaffAccountEntity.status}" />
                                </f:facet>
                                <f:facet name="output">  
                                    <h:outputText value="#{StaffAccountEntity.status}" />
                                </f:facet>
                            </p:cellEditor>
                        </p:column>  
                        <p:column headerText="Edit">  
                            <p:rowEditor />  
                        </p:column>  
                    </p:dataTable>
                </p:panel>
                <p:commandButton id="btnConfirm" actionListener="#{staffUnlockAccountManagedBean.confirmChanges}" value="Save Changes" update="accountPanel" ajax="true"/>
        </f:view>
    </ui:define>

</ui:composition>
